package cmd

import (
	"fmt"
	"gitee.com/getcharzp/light-ftp/internal/service/ls"
	"github.com/spf13/cobra"
	"os"
)

type lsCommand struct {
	cmd *cobra.Command
}

func newLsCommand() *cobra.Command {
	c := new(lsCommand)
	c.cmd = &cobra.Command{
		Use:   "ls",
		Short: "remote file list",
		Run: func(cmd *cobra.Command, args []string) {
			if len(args) == 0 {
				fmt.Println("远程路径不能为空")
				os.Exit(1)
			}
			ls.Ls(args[0])
		},
	}
	return c.cmd
}
